﻿<!DOCTYPE html>
<html>
<head>
    <title>JS Conditional Exercise 3</title>
    <link href="styles/js-console.css" rel="stylesheet" />
</head>
<body>
    <h1>Finds the biggest of three integers</h1>
    <div>
        <label for="num1">Number 1:</label>
        <input type="number" id="num1" />
        <label for="num2">Number 2:</label>
        <input type="number" id="num2" />
        <label for="num3">Number 3:</label>
        <input type="number" id="num3" />
        <button onclick="execute()">Execute</button>
    </div>
    <div id="js-console"></div>
    <script src="scripts/js-console.js"></script>
    <script>
        function execute()
        {
            var num1 = jsConsole.readInteger("#num1");
            var num2 = jsConsole.readInteger("#num2");
            var num3 = jsConsole.readInteger("#num3");

            if (num1 > num2)
            {
                if (num1 > num3)
                {
                    jsConsole.writeLine("Biggest number is: " + num1);
                }
                else
                {
                    jsConsole.writeLine("Biggest number is: " + num3);
                }
            }
            else
            {
                if (num2 > num3)
                {
                    jsConsole.writeLine("Biggest number is: " + num2);
                }
                else
                {
                    jsConsole.writeLine("Biggest number is: " + num3);
                }
            }
        }
    </script>
</body>
</html>
